# Author:	gong_libin
# Date:		2013_10_10

CC ?= g++
CFLAGS ?= -g -Wall

GLB_ENV ?= $(shell pwd)/..
GLB_BIN ?= $(GLB_ENV)/bin
GLB_INC ?= $(GLB_ENV)/inc
GLB_SRC ?= $(GLB_ENV)/src

GLB_GLIB ?= /usr/lib
GLB_GINC ?= /usr/include/GlbInc

GLB_LIBS =					\
	-lglbglobal				\
	-lpthread				\
	-ldl

GLB_TARGETS =					\
	GlbKvInput

GLB_OBJECTS =					\
	GlbKvInput.o

all: $(GLB_OBJECTS) $(GLB_TARGETS) install

$(GLB_OBJECTS): %.o: %.cpp
	$(CC) -c $(CFLAGS) -I$(GLB_GINC) -I$(GLB_INC) $< -o $@

$(GLB_TARGETS): %: %.o
	$(CC) $(CFLAGS) $(GLB_OBJS) $< -o $@ $(GLB_LIBS)

install:
	cp $(GLB_TARGETS) $(GLB_BIN)

clean:
	rm -rf $(GLB_OBJECTS)
	rm -rf $(GLB_TARGETS)
